<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>H5Canvas</title>
    <script type="text/javascript" src="js/jquery.min.js"></script>
</head>
<body>

    <canvas id="can" style="width:500px; height: 500px; border: 1px solid red"></canvas>



<script type="text/javascript">

    window.onload = function () {
    try{
        var canObj = document.querySelector("#can");
        var ctx = canObj.getContext("2d");
        ctx.beginPath();
        ctx.moveTo(40,50);
        ctx.lineTo(100,100);
        ctx.stroke();
    }catch(e){
        alert("对不起，你的浏览器不支持canvas功能");
    }


    }


</script>


</body>
</html>